import 'package:flutter/material.dart';
import 'theme_service.dart';

class ThemeNotifier extends ChangeNotifier {
  static final ThemeNotifier instance = ThemeNotifier._internal();
  ThemeNotifier._internal();

  String _currentTheme = ThemeService.themes.keys.first;
  String get currentTheme => _currentTheme;

  ThemeData get theme => ThemeService.themes[_currentTheme]!;

  Future<void> init() async {
    _currentTheme = await ThemeService.getSelectedTheme();
    notifyListeners();
  }

  Future<void> setTheme(String themeName) async {
    await ThemeService.setTheme(themeName);
    _currentTheme = themeName;
    notifyListeners();
  }
}
